package com.oktest.measure

import android.os.Bundle
import android.view.Window
import android.view.WindowManager
import androidx.core.content.ContextCompat
import com.oktest.measure.ui.fragment.login.LoginFragment
import me.yokeyword.fragmentation.SupportActivity

/**
 * @Author hhh
 * @Date 2020/10/23
 */
class LoginActivity : SupportActivity() {

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        // 全屏
        val window: Window = window
        //取消设置透明状态栏,使 ContentView 内容不再沉浸到状态栏下
        window.clearFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS)
        //需要设置这个 flag 才能调用 setStatusBarColor 来设置状态栏颜色
        window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS)
        //设置状态栏颜色
        window.statusBarColor = ContextCompat.getColor(this, R.color.transparent)
        setContentView(R.layout.activity_login)
        findFragment(LoginFragment::class.java) ?: loadRootFragment(
            R.id.loginLayout, LoginFragment()
        )
    }

}